package com.gr3g.dev.learndraw.model.draw;

import android.graphics.Path;
import android.graphics.RectF;

import com.gr3g.dev.learndraw.model.IPath;

/** @author Gregory Tardivel */
public final class Arc implements IPath {

    private int left;
    private int top;
    private int right;
    private int bottom;
    private int startAngle;
    private int sweepAngle;

    /** Cercle rempli. */
    private boolean filled;

    /** @return the filled */
    public boolean isFilled() {
        return this.filled;
    }

    /** @param pFilled the filled to set */
    public void setFilled(final boolean pFilled) {
        this.filled = pFilled;
    }

    /** @return the left */
    public int getLeft() {
        return this.left;
    }

    /** @param pLeft the left to set */
    public void setLeft(final int pLeft) {
        this.left = pLeft;
    }

    /** @return the top */
    public int getTop() {
        return this.top;
    }

    /** @param pTop the top to set */
    public void setTop(final int pTop) {
        this.top = pTop;
    }

    /** @return the right */
    public int getRight() {
        return this.right;
    }

    /** @param pRight the right to set */
    public void setRight(final int pRight) {
        this.right = pRight;
    }

    /** @return the bottom */
    public int getBottom() {
        return this.bottom;
    }

    /** @param pBottom the bottom to set */
    public void setBottom(final int pBottom) {
        this.bottom = pBottom;
    }

    /** @return the startAngle */
    public int getStartAngle() {
        return this.startAngle;
    }

    /** @param pStartAngle the startAngle to set */
    public void setStartAngle(final int pStartAngle) {
        this.startAngle = pStartAngle;
    }

    /** @return the sweepAngle */
    public int getSweepAngle() {
        return this.sweepAngle;
    }

    /** @param pSweepAngle the sweepAngle to set */
    public void setSweepAngle(final int pSweepAngle) {
        this.sweepAngle = pSweepAngle;
    }

    @Override
    public Path getPath(final float pWidth, final float pHeight) {
        final Path retour = new Path();
        final RectF oval = new RectF(this.left * pWidth / 100, this.top
                * pHeight / 100, this.right * pWidth / 100, this.bottom
                * pHeight / 100);
        retour.addArc(oval, this.startAngle, this.sweepAngle);
        return retour;
    }

    @Override
    public String toString() {
        return "Arc";
    }
}
